package com.ymxk.timestar.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import com.ymxk.timestar.activity.star.GlideImageLoader;
import com.ymxk.timestar.view.drag.DragDataEntity;
import com.ymxk.timestar.view.drag.widget.MatrixImageLayout;

import java.util.ArrayList;

/**
 * 摘星图、
 */
public class MatrixImageLayoutActivity extends AppCompatActivity {

    private Context mContext;

    public static void jumpTo(Context context) {
        Intent intent = new Intent(context, MatrixImageLayoutActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_matrix_image_layout);
        mContext = this;

        MatrixImageLayout starLayout = findViewById(R.id.starLayout);
        starLayout.setJustShowCenter(false);

        starLayout.setImageLoader(new GlideImageLoader());
        ArrayList<DragDataEntity> imageInfo = createTestImageInfos();
        starLayout.setNewData(imageInfo);
    }

    /**
     * 创建测试数据、
     *
     * @return
     */
    @NonNull
    private static ArrayList<DragDataEntity> createTestImageInfos() {
        ArrayList<DragDataEntity> imageInfo = new ArrayList<>();
        for (int i = 0; i < 9; i++) {
            DragDataEntity info = new DragDataEntity();
            //info.setThumbnailUrl("https://oss.res.gomezsz.com/oss-res/time-res/uat/8f20f84104d14a2999c03abb9a3f7792.jpg");
            info.setThumbnailUrl("https://oss.res.gomezsz.com/oss-res/time-res/uat/8f20f84104d14a2999c03abb9a3f7792.jpg");
            //info.setBigImageUrl("https://oss.res.gomezsz.com/oss-res/time-res/uat/8f20f84104d14a2999c03abb9a3f7792.jpg");
            imageInfo.add(info);
        }
        return imageInfo;
    }
}